#import "Person.h"

// 实现私有变量
@interface Person () 
@property (readwrite) NSString* uid;
@property (readwrite) int weight;
@property (readwrite) int height;
@end;


@implementation Person 
// 官方教程是不需要的，但是我的环境下需要这样写才行。
@synthesize firstName = _firstName;
@synthesize lastName = _lastName;
@synthesize uid = _uid;
@synthesize weight = _weight;
@synthesize height = _height;

- (NSString*) fullName {
  return [NSString stringWithFormat: @"%@ %@", self.firstName, self.lastName];
}
- (id) init {
  if(self = [super init]) {
    [self initWithFirstName: @"一龙" LastName: @"董"];
  }
  return self;
}
- (id) initWithFirstName: (NSString*) firstName_ LastName: (NSString*) lastName_ {
  if(self = [super init]) {
    _firstName = firstName_;
    _lastName = lastName_;
    _height = 177;
    _weight = 110;
  }
  return self;
}

- (void)assignUid {
  [self setUid: @"default uid"];
}
- (int) measureWeight {
  return [self weight];
}
- (int) measureHeight {
  return [self height];
}
@end